package com.csj.DesignPattern.iterator;

public class Client {
    public static void main(String[] args) {
        StudentAggregateImpl aggregate = new StudentAggregateImpl();
        aggregate.add(new Student("张三"));
        aggregate.add(new Student("李四"));
        aggregate.add(new Student("王五"));
        StudentIterator iterator = aggregate.getStudentIterator();
        while (iterator.hasNext()) {
            Student student = iterator.next();
            System.out.println(student.getName());
        }
    }
}
